package com.qingcheng.dao;

import com.qingcheng.pojo.user.Address;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;
import java.util.Map;

public interface AddressMapper extends Mapper<Address> {

//查询指定用户的地址
    @Select("SELECT ad.username,ad.contact,ad.phone,ad.address,ad.is_default,pr.province,ci.city,ar.area FROM "+
            "tb_address ad,tb_provinces pr,tb_cities ci,tb_areas ar WHERE ad.username=#{username}"+
            "AND ad.provinceid=pr.provinceid AND ad.cityid=ci.cityid AND ad.areaid=ar.areaid")
    public List<Map> selectByAddress(@Param("username") String username);

}